import React, { Component } from 'react'
import Son from './Son'
// 接收context数据的方式二
import context from '../context'
export default class Far extends Component {
  // Far组件要接收App传递的数据,则给Far添加静态属性contextType.值为context对象
  static contextType = context
  render() {
    return (
      <div>
        Far
        <hr />
        {/* 只要添加了静态属性contextType.则组件实例就可以通过context属性直接拿到传递的数据*/}
        {this.context}
        <hr />
        <Son></Son>
      </div>
    )
  }
}
